<?php include("head.php"); ?>
    <div class="sui-layout">
		  <div class="sidebar">
<?php include("leftmenu.php"); ?>	  	
		  </div>
		  <div class="content">
			<p class="sui-text-xxlarge my-padd">成绩查询</p>
            <!-- 所有课程的列表 -->
            <table class="sui-table table-primary">
                <tr><th>姓名</th><th>学号</th><th>课程名称</th><th>成绩</th></tr>
                <?php
                    include("conn.php");
                    $xuehao = $_REQUEST["xuehao"];
                    $names = $_REQUEST["names"];
                    $kcname = $_REQUEST["kcname"];
                    //执行sql语句
                    // $sql = "select * from student where 姓名='{$names}' and 学号='{$xuehao}'";
                    // $sql = "select `选修`.`学号`,`姓名`,`课程名称`,`成绩` from `选修` left join `student` ON `选修`.`学号`=student.`学号` left join `课程` on 选修.`课程编号`=`课程`.`课程编号` where `姓名`='{$names}' and `学号`='{$xuehao}' and `课程名称`='{$kcname}'";
                    $sql = "select * FROM `选修` LEFT JOIN `student` ON `选修`.`学号` = student.`学号`
                    LEFT JOIN `课程` ON 选修.`课程编号` = `课程`.`课程编号` where 姓名='{$names}' and 选修.`学号`='{$xuehao}'  and 选修.`课程编号`='{$kcname}'";
                    $result = mysqli_query($conn,$sql);
                    // var_dump($result);
                    if( mysqli_num_rows($result)>0 ){
                        while ($arr = mysqli_fetch_assoc($result)){
                            echo "<tr>
                                <td>{$arr['姓名']}</td>
                                <td>{$arr['学号']}</td>
                                <td>{$arr['课程名称']}</td>
                                <td>{$arr['成绩']}</td>
                            </tr>";
                        }
                    }else{
                        echo "暂没有记录";
                    }
                ?>
            </table>
		  </div>
		</div>		
    </div>
<?php include("foot.php"); ?>